#include <iostream> 
#include "circularList.h"

using namespace std;

int main()
{
	  circularChain<int> y, z;
	
	  // test size
    cout << "Initial size of y and z = "
         << y.size() << ", "
         << z.size() << endl;
		 
	  // test insert
    y.insert(0, 2);
    y.insert(1, 6);
    y.insert(0, 1);
    y.push_back(4);
    y.push_back(5);
    y.push_back(3);
  
    cout << "Inserted 6 integers, list y should be 1 2 3 4 5 6" << endl;
    cout << "Size of y = " << y.size() << endl;
    y.out_put(cout);

    y.pop_back();
    cout << endl << "Testing pop_back " << endl;
    cout << y << endl; 	
    
    y.remove(6);
    y.remove(2);
    cout << endl << "Testing remove " << endl;
    cout << y << endl;
    
    cout << "Test iterator: ";
    circularChain<int>::iterator iter = y.begin();
    for ( ; iter != y.end(); iter++)
        cout << *iter << " ";
    
    cout << endl;

    // test index
    int index = y.index(4);
    if (index < 0) 
		cout << "4 not found" << endl;
    else 
		cout << "The index of 4 is " << index << endl;
    
    index = y.index(1);
    if (index < 0) 
		cout << "1 not found" << endl;
    else 
		cout << "The index of 1 is " << index << endl;

    y.clear();
    cout << endl << "Testing clear " << endl;
    cout << y << endl;

    
    return 0;
}